(function(){
	angular.module("webApp").controller("ProfitCtrl",ProfitCtrl);
	ProfitCtrl.$inject=['$scope','dataService','helper','$state','$location'];
	function ProfitCtrl($scope,dataService,helper,$state,$location){
		$scope.listAction=function(){
			$scope.page_Size=10;
			$scope.profitList(1);
		}
		$scope.profitList=function(page_No){
			var query={page_no:page_No,page_size:$scope.page_Size};
			if($scope.partner_id){
				query.query={partner_id:partner_id}
			}
			dataService.profitGet(query).then(function(result){
				if(result.Msg){
					helper.myAlert("error:"+result.Msg);
				}else{
					$scope.profits=result.shop;
					$scope.profitsTotal=result.total_count;
				}
			});
		}
		$scope.infoAction=function(){
			var partner_id= $location.serach().partner_id;
			dataService.profitOne(partner_id).then(function(profit){
				if(profit.Msg){
					helper.myAlert("error:"+profit.Msg);
				}else{
					$scope.profit=profit;
				}
			});
		}
	}
})();